package sumlogic

import (
	"common/comRedis"
	"context"
	"service/internal/svc"
	"service/pb"
	"time"

	"github.com/zeromicro/go-zero/core/logx"
)

type RemoveLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRemoveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveLogic {
	return &RemoveLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *RemoveLogic) Remove(in *pb.SumRequest) (*pb.SumResponse, error) {
	// todo: add your logic here and delete this line
	//user, err := comJwt.BackUser(l.ctx, l.svcCtx.Config.USERDATA)
	//if err != nil {
	//	return nil, err
	//}
	prams := comRedis.RedisPrams{
		Rdb: l.svcCtx.Rdb,
		Ctx: l.ctx,
		Key: "user:" + "123",
		//Expiration: 1 * time.Minute,
		LockKey:        "userLock:" + "123",
		LockValue:      "123",
		LockExpiration: 1 * time.Minute,
	}
	err := comRedis.DellRedisKey(&prams)
	if err != nil {
		return nil, err
	}
	a := Slew{}
	err = comRedis.SetRedisStruct(&prams, a)
	if err != nil {
		return nil, err
	}
	return &pb.SumResponse{}, nil
}
